#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int count = 0;
    while (n > 0)
    {
        int tmp = n;
        int find = 0;
        while (tmp > 0)
        {
            if (tmp % 10 >= 5)
            {
                find = 1;
                break;
            }
            tmp /= 10;
        }
        if (!find)
            count++;
        scanf("%d", &n);
    }
    printf("%d\n", count);
    return 0;
}